﻿using System;
using System.Collections.ObjectModel;
using System.Data.SqlClient;
using DataAccess;
using Entities;

namespace Business
{
 public   class CountyBusiness
    {
     /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <value>
        /// The instance.
        /// </value>
        public static CountyBusiness Instance { get; private set; }

        /// <summary>
        /// Initializes the <see cref="AddressBusiness" /> class.
        /// </summary>
        static CountyBusiness() { Instance = new CountyBusiness(); }


        /// <summary>
        /// Gets the county.
        /// </summary>
        /// <param name="countyId">The county id.</param>
        /// <returns></returns>
        public County GetCounty(string countyId)
        {
            try
            {
                if (!string.IsNullOrEmpty(countyId) && countyId != Guid.Empty.ToString())
                    return CountyDataAccess.Instance.GetCounty(countyId);
                return null;
            }
            catch (SqlException)
            {


                return null;
            }

        }

        /// <summary>
        /// Gets the by gov office region.
        /// </summary>
        /// <param name="govOfficeRegionId">The gov office region id.</param>
        /// <returns></returns>
        public Collection<County> GetByGovOfficeRegion(string govOfficeRegionId)
        {
            var listCounty = CountyDataAccess.Instance.GetCountyByGovOfficeRegion(govOfficeRegionId);
            return listCounty;
        }
    
    }
}
